package com.joshua.spring.form;

import com.joshua.spring.entity.em.ResponseEnum;
import com.joshua.spring.entity.form.FormInter;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * description
 * package com.joshua.spring.form
 * classname  QueryRuleInfoForm
 *
 * @author <a href="mailto:joshualwork@163.com">joshua_liu</a>
 * @date 2020/4/3 10:43
 */
@Data
@Slf4j
public class QueryRuleInfoForm implements FormInter {
    private Integer id;
    private String name;
    private List<String> bindIds;

    @Override
    public void checkParams() {
        log.info("check params of class QueryRuleInfoForm ===>[{}]", this);
        if (CollectionUtils.isEmpty(bindIds) || StringUtils.isEmpty(name) || StringUtils.isEmpty(id)) {
            throw ResponseEnum.USER_REQUEST_SERVER_FAIL.bdException();
        }
    }
}
